toRgba

Converts frame to width * height * 4 RGBA bytes with no row padding.

A VideoToolbox frame converts through its downloaded software twin, one measured copy per frame, which is exactly what HardwareWithDownload reports upstream. Hardware kinds that cannot be read back still refuse inside KiteFFmpegVideoFrame.readableFrame.


toRgba into reuse when it is exactly width * height * 4 bytes, and into a new array otherwise. A renderer that passes back the array it got for the previous frame allocates the RGBA bytes once instead of once per frame. It must be done with that array first: the bytes are overwritten in place.


toRgba with both of its arrays taken from buffers: the planes copied out of KiteFFmpeg, and the RGBA bytes. A renderer that keeps one Buffers allocates neither array again until the frame size changes. The returned array belongs to buffers, and the next call with the same buffers overwrites it.